<?php 
ob_start();
require_once '../sub/init.php';
$uid=intval($uid);
if(!is_mobile())header("Location: ".a('{"kind":"u","mp":"p","uid":'.$uid.'}'));
require_once ZEAI.'cache/config_vip.php';
require_once ZEAI.'cache/config_index.php';
require_once ZEAI.'sub/conn.php';
require_once ZEAI.'cache/udata.php';
require_once ZEAI.'sub/www_zeai_cn_sms.php';
$jumpurl = a('{"kind":"u","uid":"'.$uid.'"}');
$noustr='用户不存在或已经服务成功';
$cook_uid=intval($cook_uid);
$user_bbs = json_decode($_ZEAI['user_bbs'],true);
$urole = json_decode($_ZEAI['urole'],true);
//$hh_expire_day=$_ZEAI['hh_expire_day']*86400;
if(is_mjapp() && !iflogin()){
	require_once ZEAI.'api/magapp/login/CSfn_iflogin.php';
}
if($submitok=='ajax_hi_rand'){
	$C='';
	if($_SMS['hi_kind']==2 && in_array('hi',$navarr)){
		$hi_textlist=explode('<br>',$_SMS['hi_textlist']);
		if (count($hi_textlist) >= 1 && is_array($hi_textlist)){
			$hi_textlist=shuffle_arr($hi_textlist);
			$h=0;
			foreach ($hi_textlist as $V) {
				if($h==4)continue;
				$V=trimhtml(dataIO($V,'out'));
				$C .= '<li><i class="ico zeaicolor">&#xe8ca;</i>'.$V.'</li>';
				$h++;
			}
		}
	}
	exit(dataIO($C,'in'));
}elseif($submitok== 'utext' && $cook_ifadm==1){
	if (!ifint($uid))json_exit(array('flag'=>0,'msg'=>'亲，用户不存在'));
	$C = get_udata_text($uid);
	if(!empty($C)){
		json_exit(array('flag'=>1,'C'=>$C));
	}else{
		json_exit(array('flag'=>0,'msg'=>'用户不存在'));
	}
}elseif($submitok== 'ajax_gift2_rand'){
	$C='';
	$rt=$db->query("SELECT id,title,price,picurl FROM ".__TBL_GIFT__." ORDER BY RAND() LIMIT 8");
	$total = $db->num_rows($rt);
	if ($total > 0) {
		for($i=1;$i<=$total;$i++) {
			$rows = $db->fetch_array($rt,'num');
			if(!$rows)break;
			$id     = $rows[0];
			$title  = dataIO($rows[1],'out');
			$price  = $rows[2];
			$picurl = UP.$rows[3];
			$C .= '<li gid="'.$id.'"><img src="'.$picurl.'"><h4>'.$title.'</h4><h5><i class="ico">&#xe618;</i>'. $price.'</h5></li>';
		}
	}else{$C = "<div class='nodatatips'><i class='ico'>&#xe608;</i>暂时木有上架礼物</div>";}	
	exit(dataIO($C,'in'));
}elseif($submitok=='ajax_bbs_iflogin'){
	if(!iflogin()){
		json_exit(array('flag'=>'nologin','jumpurl'=>$jumpurl));
	}else{
		json_exit(array('flag'=>1,'jumpurl'=>$jumpurl));
	}
}elseif($submitok=='ajax_bbs_add'){
	if(@!in_array('ubbs',$navarr))json_exit(array('flag'=>0,'msg'=>'此功能已关闭'));
	if (!ifint($uid))json_exit(array('flag'=>0,'msg'=>'zeaierr:uid'));
	if(!iflogin())json_exit(array('flag'=>'nologin','msg'=>'请您先登录','jumpurl'=>$jumpurl));
	if ($uid == $cook_uid)json_exit(array('flag'=>0,'msg'=>'亲，操作自己有意义么'));
	$content = dataIO(trimhtml($content),'in',2000);
	if (empty($content))json_exit(array('flag'=>0,'msg'=>'请输入评价内容'));
	//
	$add_authARR = explode(',',$user_bbs['add_auth']);
	if (count($add_authARR) >= 1 && is_array($add_authARR)){
		foreach ($add_authARR as $V) {
			switch ($V) {
				case 'hh2':
					$hhnum = $db->COUNT(__TBL_HH__," senduid=".$cook_uid." AND uid=".$uid." AND ifagree=1");
					if($hhnum==0)json_exit(array('flag'=>0,'msg'=>'亲，只有【双方成功互换联系方法成功】才可以评价哦'));
				break;
				case 'gz2':
					if (gzflag($uid,$cook_uid) != 1 || gzflag($cook_uid,$uid) != 1)json_exit(array('flag'=>0,'msg'=>'亲，只有【双方互相关注加好友】才可以评价哦'));
				break;
				case 'chat2':
					$num1 = $db->COUNT(__TBL_UCOUNT__,"FIND_IN_SET($uid,listed) AND kind='chat' AND uid=".$cook_uid);
					$num2 = $db->COUNT(__TBL_UCOUNT__,"FIND_IN_SET($cook_uid,listed) AND kind='chat' AND uid=".$uid);
					if ($num1 == 0 || $num2 == 0)json_exit(array('flag'=>0,'msg'=>'亲，只有【双方私信聊过天】才可以评价哦'));
				break;
				case 'vip':
					$row = $db->ROW(__TBL_USER__,"sex,grade","id=".$cook_uid,"name");
					$cook_sex    = intval($row['sex']);
					$cook_grade  = intval($row['grade']);
					if($cook_grade<2){
						sort($urole);
						foreach (@$urole as $uv){
							if($uv['f']== 0)continue;
							$my_json_hhnum_str=($uv['g']==$cook_grade)?' <i class=\"ico C999\">&#xe62c;</i> <font class=\"Cf00\">我</font>':'<i class=\"ico C090\">&#xe60f;</i>　';
							$json_str.='【'.str_replace('"','\"',uicon($cook_sex.$uv['g'])).$uv['t'].'】'.$my_json_hhnum_str.'<br>';
						}
						json_exit(array('flag'=>'nolevel','msg'=>'亲，只有VIP会员才可能评价哦<br><br>'.$json_str,'jumpurl'=>$jumpurl));
					}
				break;
			}	
		}
	}
	//
	$bbsnum_ed = $db->COUNT(__TBL_USER_BBS__," (senduid=".$cook_uid." AND uid=".$uid.") ");
	if($bbsnum_ed>0)json_exit(array('flag'=>0,'msg'=>'亲，您已评价过了哦'));
	$flag = ($user_bbs['add_ifsh']==1)?0:1;
	$db->query("INSERT INTO ".__TBL_USER_BBS__." (uid,senduid,content,addtime,flag) VALUES ($uid,$cook_uid,'$content',".ADDTIME.",$flag)");
	json_exit(array('flag'=>1,'msg'=>'评价成功'));
}elseif($submitok== 'ajax_iflogin' || $submitok== 'ajax_hh_update'){
	if (!ifint($uid))zeaialert('{"title":"'.$noustr.'","btnt":"我知道了","url":"-1"}');
	if(!iflogin()){
		json_exit(array('flag'=>'nologin','msg'=>'请您先登录','jumpurl'=>$jumpurl));
	}else{
		if ($uid == $cook_uid)json_exit(array('flag'=>0,'msg'=>'亲，操作自己有意义么'));
		//检查拉黑
		if (gzflag($uid,$cook_uid) == -1)json_exit(array('flag'=>0,'msg'=>'你已将对方拉黑了,还互换？'));
		if (gzflag($cook_uid,$uid) == -1)json_exit(array('flag'=>0,'msg'=>'对方觉得你不太适合Ta，请求失败'));
		if($kind=='mob'){
			$kind_str='手机号码';
		}else{
			$kind='weixin';$kind_str='微信号';
		}
		//检查是否拒绝
		$row = $db->ROW(__TBL_HH__,"id"," kind='$kind' AND senduid=".$cook_uid." AND uid=".$uid." AND ifagree=2 ","name");
		if ($row){
			$kind = ($kind=='mob')?'mob':'weixin';
			json_exit(array('flag'=>0,'msg'=>'亲，对方暂时不想与您互换【'.$kind_str.'】'));
		}
		//同级查看
		nolevel($uid,$cook_uid,'contact',$jumpurl);
		//我的信息
		$row = $db->ROW(__TBL_USER__,"sex,grade,hh_num,weixin,photo_s,RZ,photo_f,myinfobfb,sign_pdf_flag","id=".$cook_uid,"name");
		$cook_sex    = intval($row['sex']);
		$cook_grade  = intval($row['grade']);
		$cook_hh_num = intval($row['hh_num']);
		$cook_weixin = trimhtml(dataIO($row['weixin'],'out'));
		$cook_photo_s = $row['photo_s'];
		$cook_photo_f = intval($row['photo_f']);
		$cook_RZ = $row['RZ'];$cook_RZarr = explode(',',$cook_RZ);
		$cook_myinfobfb = intval($row['myinfobfb']);
		$cook_sign_pdf_flag  = $row['sign_pdf_flag'];
		//前置条件
		$hh_data = explode(',',$_VIP['hh_data']);
		if(count($hh_data)>0 && is_array($hh_data)){
			if(empty($cook_photo_s))$cook_photo_f=0;
			$row0 = $db->ROW(__TBL_USER__,"sex","id=".$uid,"num");$sexx=$row0[0];
			$json=array("ARR"=>$hh_data,"jumpurl"=>$jumpurl,"RZarr"=>$cook_RZarr,"sex"=>$sexx,"cook_sex"=>$cook_sex,"cook_grade"=>$cook_grade,"cook_photo_f"=>$cook_photo_f,"cook_myinfobfb"=>$cook_myinfobfb,"data_bfb_num"=>intval($_VIP['hh_bfb_num']),"cook_sign_pdf_flag"=>$cook_sign_pdf_flag,"js"=>$js);
			Before_TJ(encode_json($json));
		}
		//
		$hh_numARR = json_decode($_VIP['hh_num'],true);
		/*检查会员组有没有权限
		if($cook_hh_num<$hh_numARR[$cook_grade] && $hh_numARR[$cook_grade]>0){
			$cook_hh_num = $hh_numARR[$cook_grade];
			$db->query("UPDATE ".__TBL_USER__." SET hh_num='$cook_hh_num' WHERE id=".$cook_uid);
		}
		*/
		$cook_hh_num_ed = $db->COUNT(__TBL_HH__," senduid=".$cook_uid);
		$maxnum=intval(max($hh_numARR));
		foreach($hh_numARR as $key=>$value){if($value == $maxnum)$maxkey=$key;}
		//全部级别最多次数字符串
		sort($urole);sort($urole);
		$json_hhnum_str='';
		foreach (@$urole as $uv){
			if($uv['f']== 0)continue;
			$my_json_hhnum_str=($uv['g']==$cook_grade)?'<font class=\"Cf00\">我</font>':'　';
			$json_hhnum_str.='【'.str_replace('"','\"',uicon($cook_sex.$uv['g'])).$uv['t'].' '.$hh_numARR[$uv['g']].' 次】'.$my_json_hhnum_str.'<br>';
		}
		//全部结束
		$cook_hh_num_ed = ($cook_hh_num_ed>0)?'<br>您已互换了<font class=Cf00> '.$cook_hh_num_ed.' </font>次，<a class=\'blue\' href=my_huhuan.php>查看互换记录</a>':'';
		$tipsarr1=array('flag'=>'nolevel','msg'=>'<br>您当前没有互换次数或已用完'.$cook_hh_num_ed.'<br><br>'.$json_hhnum_str,'jumpurl'=>$jumpurl);
		//$tipsarr2=array('flag'=>'nolevel','msg'=>'您的互换次数已达上限'.$cook_hh_num.'次<br><br>'.$json_hhnum_str,'jumpurl'=>$jumpurl);
		if($cook_hh_num==0)json_exit($tipsarr1);
		/*
		if($cook_hh_num_ed>=$cook_hh_num){
			if($cook_hh_num<$maxnum){
				json_exit($tipsarr2);
			}else{
				json_exit(array('flag'=>0,'msg'=>'您的互换次数已达上限'.$cook_hh_num.'次，请联系客服增加'));
			}
		}
		*/
		if($submitok== 'ajax_iflogin'){
			json_exit(array('flag'=>1));
		}elseif($submitok== 'ajax_hh_update'){
			$content=trimhtml($content);
			if($kind=='mob'){
				if(!ifmob($content))json_exit(array('flag'=>0,'msg'=>'请输入您要互换的【'.$kind_str.'】'));
			}else{
				if(str_len($content)<4)json_exit(array('flag'=>0,'msg'=>'请输入您要互换的【'.$kind_str.'】'));
			}
			$row = $db->ROW(__TBL_HH__,"id"," kind='$kind' AND senduid=".$cook_uid." AND uid=".$uid."   ","name");
			if ($row){
				$db->query("UPDATE ".__TBL_HH__." SET senduid_content='$content',addtime=".ADDTIME." WHERE kind='$kind' AND senduid=".$cook_uid." AND uid=".$uid);
				$hhid=$row['id'];
			}else{
				$db->query("INSERT INTO ".__TBL_HH__." (kind,uid,senduid,senduid_content,addtime) VALUES ('$kind','$uid','$cook_uid','$content',".ADDTIME.")");
				$hhid=$db->insert_id();
			}
			$db->query("UPDATE ".__TBL_USER__." SET hh_num=hh_num-1 WHERE hh_num>0 AND id=".$cook_uid);
			//主表空，更新
			if(empty($cook_weixin) && $kind=='weixin'){
				$weixin = dataIO($content,'in',50);
				$db->query("UPDATE ".__TBL_USER__." SET weixin='$weixin' WHERE id=".$cook_uid);
				$row_shalou=shalou_data($cook_uid);
				$row_shalou['weixin'] = $weixin;
				$jsonstr = encode_json($row_shalou);
				$db->query("UPDATE ".__TBL_SHALOU__." SET jsonstr='$jsonstr' WHERE uid=".$cook_uid);
			}
			//对方UID
			$rowta = $db->ROW(__TBL_USER__,"mob,openid,subscribe,magapp_uid","id=".$uid,"name");
			$ta_mob       = $rowta['mob'];
			$ta_openid    = $rowta['openid'];
			$ta_subscribe = $rowta['subscribe'];
			$ta_magapp_uid= $rowta['magapp_uid'];
			//$ta_nickname  = trimhtml(dataIO($row['nickname'],'out'));
			//通知
			if(!empty($ta_openid) && $ta_subscribe==1 || ifint($ta_magapp_uid)){
				$mbnickname = urlencode($cook_nickname.' ID:'.$cook_uid);
				$first  = urlencode("您好，在 ".date("Y-m-d H:i:s",ADDTIME)." 有人想和你互换".$kind_str);
				$remark = urlencode("互换微信/电话，和骚扰说拜拜~");
				$mbcontent = '点击进入【同意】或【拒绝】';
				$href=HOST.'/m/my_huhuan.php?id='.$hhid;
				@wx_mb_sent('mbbh=ZEAI_MSG_CHAT&magapp_uid='.$ta_magapp_uid.'&openid='.$ta_openid.'&content='.$mbcontent.'&nickname='.$mbnickname.'&first='.$first.'&remark='.$remark.'&url='.urlencode($href));
			}
			//短信
			if(ifmob($ta_mob) && $sms_onoff['huhuan'] == 1){
				$rtn = Zeai_sendsms_authcode($ta_mob,$cook_uid.'|WWW_A9A_CN|'.$hhid,'huhuan');
				if ($rtn != 0)json_exit(array('flag'=>0,'msg'=>'错误码：'.$rtn.'-'.sms_error($rtn)));
			}
			//站内
			$title=$cook_nickname.' ID:'.$cook_uid.'想与你互换'.$kind_str;
			$db->SendTip($uid,$title,dataIO($title.'，请进入手机端【我的】->【互换】点击同意或拒绝 ','in',1000),'sys');
			json_exit(array('flag'=>1,'msg'=>'<center class=\"C090 S18 B\"><i class=\"ico\">&#xe67f;</i> 发送成功</center><br><i class=\"ico\">&#xe634;</i> 请等待对方同意...<br>同意后您将收到对方的'.$kind_str.'<br>您也可以在【我的】<i class=\"ico\">&#xe62d;</i>【互换】查看进展<br><br>'));
		}
	}
	exit;
}
$switch = json_decode($_ZEAI['switch'],true);
$qianxian_num = json_decode($_VIP['qianxian_num'],true);
$qx_1price = floatval($_VIP['qx_1price']);
if (!ifint($uid))zeaialert('{"title":"'.$noustr.'","btnt":"我知道了","url":"-1"}');
/*是否登录*/
if(!empty($submitok) || $_VIP['YKviewU'] != 1 || ifint($cook_uid)){
	if(!iflogin()){
		if($js==1){
			json_exit(array('flag'=>'nologin','jumpurl'=>$jumpurl));
		}else{
			header("Location: ".HOST."/m/login.php"."?jumpurl=".urlencode($jumpurl));exit;
		}
	}
	//我的信息
	$cook_uid=intval($cook_uid);
	$row = $db->ROW(__TBL_USER__,"nickname,grade,loveb,money,birthday,heigh,pay,edu,RZ,myinfobfb,photo_s,photo_f,ifadm,sex,crm_qxnum,admid","id=".$cook_uid);
	if ($row){
		$cook_loveb = $row['loveb'];
		$cook_money = $row['money'];
		$cook_grade = $row['grade'];
		$cook_RZ = $row['RZ'];$cook_RZarr = explode(',',$cook_RZ);
		$cook_myinfobfb = intval($row['myinfobfb']);
		$cook_photo_s   = $row['photo_s'];
		$cook_photo_f   = intval($row['photo_f']);
		$cook_ifadm     = intval($row['ifadm']);
		$cook_sex       = intval($row['sex']);
		$cook_nickname = trimhtml(dataIO($row['nickname'],'out'));
		$cook_nickname = (empty($cook_nickname))?'uid:'.$cook_uid:$cook_nickname;
		$cook_birthday = $row['birthday'];
		$cook_heigh    = intval($row['heigh']);
		$cook_pay      = intval($row['pay']);
		$cook_edu      = intval($row['edu']);
		$cook_qxnum    = intval($row['crm_qxnum']);
		$cook_admid    = intval($row['admid']);
	}
	if(@in_array('hn',$navarr)){
		$cook_qxnum_ed       = $db->COUNT(__TBL_QIANXIAN__," (senduid=".$cook_uid." OR uid=".$cook_uid.") ");//我的已牵总数
		$cook_qxnum_ed_herme = $db->COUNT(__TBL_QIANXIAN__," (senduid=".$cook_uid." AND uid=".$uid." OR senduid=".$uid." AND uid=".$cook_uid.") ");//与此会员已牵总数
	}
	//红娘牵线
	if($submitok=='ajax_qx'){
		$uid=intval($uid);$admid=intval($admid);
		if ($cook_qxnum_ed_herme>0)json_exit(array('flag'=>0,'msg'=>'您和Ta已在牵线，请不要重复提交'));
		if($cook_qxnum==0){
			if($qx_1price>0){
				json_exit(array('flag'=>'qx_1price'));
			}else{
				//json_exit(array('flag'=>0,'msg'=>'请长按二维码加红娘微信进行牵线咨询'));
				$maxnum=intval(max($qianxian_num));
				if($maxnum==0)json_exit(array('flag'=>0,'msg'=>'请长按二维码加红娘微信进行牵线咨询'));
				foreach($qianxian_num as $key=>$value){if($value == $maxnum)$maxkey=$key;}
				json_exit(array('flag'=>'nolevel','msg'=>'您的牵线次数不足，请升级【'.utitle($maxkey).'】最多享受 <font class=Cf00>'.$maxnum.'</font> 次牵线','jumpurl'=>$jumpurl));
			}
		}
		//正式开始
		$rowhn = $db->ROW(__TBL_CRM_HN__,"truename,agentid,agenttitle,openid,subscribe,mob","flag=1 AND id=".$admid,'name');
		if($rowhn){
			$admname      =trimhtml(dataIO($rowhn['truename'],'out'));
			$admagentid   =$rowhn['agentid'];
			$admagenttitle=$rowhn['agenttitle'];
			$admopenid   = $rowhn['openid'];
			$admsubscribe= $rowhn['subscribe'];
			$admmob      = $rowhn['mob'];
		}else{
			json_exit(array('flag'=>0,'msg'=>'亲，红娘不存在'));
		}
		if(empty($cook_admid))$db->query("UPDATE ".__TBL_USER__." SET agentid=$admagentid,agenttitle='$admagenttitle',admid=".$admid.",admname='$admname',admtime=".ADDTIME." WHERE id=".$cook_uid);
		$db->query("INSERT INTO ".__TBL_QIANXIAN__." (admid,admname,uid,senduid,sendkind,addtime) VALUES ($admid,'$admname',$uid,$cook_uid,1,".ADDTIME.")");
		
		//牵线次数减1
		if($cook_qxnum>0)$db->query("UPDATE ".__TBL_USER__." SET crm_qxnum=crm_qxnum-1 WHERE id=".$cook_uid);
		
		//短信
		if(ifmob($admmob) && $sms_onoff['CrmQxHn'] == 1){Zeai_sendsms_authcode($admmob,$cook_uid,'CrmQxHn');}

		//微信通知红娘
		if ($admsubscribe == 1 && !empty($admopenid)){
			//客服通知
			$sex_title = ($cook_sex == 2)?'她':'他';
			$content   = urlencode('【'.$cook_nickname.' uid:'.$cook_uid.'】想委托您为'.$sex_title.'服务，请到CRM工作台->左侧菜单->【线上牵线】进行牵线服务');
			$ret = @wx_kf_sent($admopenid,$content,'text');
			$ret = json_decode($ret);
			//模版通知
			if ($ret->errmsg != 'ok'){
				$keyword1  = $content;
				$keyword3  = urlencode($_ZEAI['siteName']);
				@wx_mb_sent('mbbh=ZEAI_ADMIN_INFO&openid='.$hn_openid.'&keyword1='.$keyword1.'&keyword3='.$keyword3.'&time='.ADDTIME.'&first='.$first.'&remark='.$remark.'&url=');
			}
		}
		json_exit(array('flag'=>1,'msg'=>'牵线请求已发送成功<br>请等待【'.$admname.'】接洽'));
	}
	//扫黑除恶-发送提醒
	if($submitok=='ajax_sendchcit'){
		$row = $db->ROW(__TBL_USER__,"openid,subscribe,chatHiContact_iftips,magapp_uid","(kind=1 OR kind=3) AND id=".$uid,"name");
		if(!$row)json_exit(array('flag'=>0,'msg'=>'此用户无法发送'));
		$openid=$row['openid'];$subscribe=$row['subscribe'];$chatHiContact_iftips=$row['chatHiContact_iftips'];$magapp_uid=$row['magapp_uid'];
		$content="用户【".$cook_nickname." ID:".$cook_uid."】觉得你不错，对你有意，由于你没有诚信认证，Ta无法联系你，缘分就在一瞬间，好就别错过啦，赶快去认证！";
		if (!empty($openid) && $subscribe==1 && $cook_uid!=$uid || ifint($magapp_uid)){// && $chatHiContact_iftips==1
			$mbnickname = urlencode($cook_nickname);
			$first  = urlencode("您好，在 ".date("Y-m-d H:i:s",ADDTIME)." 收到访客认证请求！");
			$remark = urlencode($content);
			$mbcontent = '通知';
			@wx_mb_sent('mbbh=ZEAI_MSG_CHAT&magapp_uid='.$magapp_uid.'&openid='.$openid.'&content='.$mbcontent.'&nickname='.$mbnickname.'&first='.$first.'&remark='.$remark.'&url='.urlencode(a('{"kind":"cert}')));
		}
		if($chatHiContact_iftips==1){
			$db->query("UPDATE ".__TBL_USER__." SET chatHiContact_iftips=0 WHERE chatHiContact_iftips=1 AND id=".$uid);
			$db->SendTip($uid,'收到访客认证请求',dataIO($content.' <a href='.a('{"kind":"cert","mp":"pc"}').' class=aQING>去认证</a>','in'),'sys');
		}
		json_exit(array('flag'=>1,'msg'=>'提醒成功'));
	}	
	//adm
	if($submitok=='ajax_adm' && $cook_ifadm==1){
		switch ($kind) {
			case 'top':
				$db->query("UPDATE ".__TBL_USER__." SET refresh_time=".ADDTIME." WHERE id=".$uid);
				json_exit(array('flag'=>1,'msg'=>'用户【置顶】成功!'));
			break;
			case 'bottom':
				$limt = 31;
				$rowa = $db->ROW(__TBL_USER__,"refresh_time,id","photo_s<>'' AND photo_f=1 ORDER BY refresh_time DESC LIMIT $limt,1");
				$refresh_time = abs(intval($rowa[0]-cdstr(5)));
				$db->query("UPDATE ".__TBL_USER__." SET refresh_time=".$refresh_time." WHERE id=".$uid);
				json_exit(array('flag'=>1,'msg'=>'用户【置底】成功!'));
			break;
			case 'flag_2':
				$rowa = $db->ROW(__TBL_USER__,"flag","id=".$uid,"name");
				$flag=$rowa['flag'];
				if($flag==-2){
					$sql="flag=1";
					$str='取消隐藏';
				}else{
					$sql="flag=-2";
					$str='隐藏';
				}
				$db->query("UPDATE ".__TBL_USER__." SET ".$sql." WHERE id=".$uid);
				json_exit(array('flag'=>1,'msg'=>'用户【'.$str.'】成功!'));
			break;
			case 'flag_1':
				$db->query("UPDATE ".__TBL_USER__." SET flag=-1 WHERE id=".$uid);
				json_exit(array('flag'=>1,'msg'=>'用户【锁定】成功!'));
			break;
		}
	}
}
//检查拉黑
if (ifint($cook_uid)){
	if (gzflag($cook_uid,$uid) == -1){
		if(!empty($submitok)){
			json_exit(array('flag'=>0,'msg'=>'对方已经将你屏蔽，请求失败'));
		}else{
			zeaialert('{"title":"对方已经将你屏蔽，请求失败","btnt":"我知道了","url":"-1"}');
		}
	}
}
//功能开关，浏览个人主页
if ($uid != $cook_uid && $cook_ifadm!=1 && $_VIP['YKviewU'] != 1){
	$viewhomepage_data = explode(',',$_VIP['viewhomepage_data']);
	if(count($viewhomepage_data)>0 && is_array($viewhomepage_data)){
		//前置条件
		$row0 = $db->ROW(__TBL_USER__,"sex","id=".$uid,"num");$sexx=$row0[0];
		if(empty($cook_photo_s))$cook_photo_f=0;
		$json=array("ARR"=>$viewhomepage_data,"jumpurl"=>$jumpurl,"RZarr"=>$cook_RZarr,"sex"=>$sexx,"cook_sex"=>$cook_sex,"cook_grade"=>$cook_grade,"cook_photo_f"=>$cook_photo_f,"cook_myinfobfb"=>$cook_myinfobfb,"data_bfb_num"=>intval($_VIP['viewhomepage_bfb_num']),"js"=>$js);
		Before_TJ(encode_json($json));
	}
}
/*异步操作处理*/
switch ($submitok) {
	case 'ajax_gz':
		if ($uid == $cook_uid)json_exit(array('flag'=>0,'msg'=>'亲！关注自己有意义么'));
		$rowtx = $db->NUM($uid,"sex");if ($rowtx){$sex= $rowtx[0];}else{exit(JSON_ERROR);}
		//if($cook_sex==$sex)json_exit(array('flag'=>0,'msg'=>'同性不能操作＾_＾'));
		$F = 1;$C = '关注成功';
		if (gzflag($cook_uid,$uid) != -1){
			$returngz = gzflag($uid,$cook_uid);
			if ($returngz == -1){
				$db->query("UPDATE ".__TBL_GZ__." SET flag=1 WHERE uid=".$uid." AND senduid=".$cook_uid);
			}elseif($returngz == 1){
				$db->query("DELETE FROM ".__TBL_GZ__." WHERE uid=".$uid." AND senduid=".$cook_uid);
				$F = 0;
				$C = '取消成功';
			}elseif($returngz == 0){
				$db->query("INSERT INTO ".__TBL_GZ__."(uid,senduid,px) VALUES ($uid,$cook_uid,".ADDTIME.")");
			}
		}
		json_exit(array('flag'=>$F,'msg'=>$C));
	break;
	//index_more_big.php
	case 'ajax_gz1':
		if ($uid == $cook_uid)json_exit(array('flag'=>0,'msg'=>'亲！操作自己有意义么'));
		$rowtx = $db->NUM($uid,"sex");if ($rowtx){$sex= $rowtx[0];}else{exit(JSON_ERROR);}
		if($cook_sex==$sex)json_exit(array('flag'=>0,'msg'=>'同性不能操作＾_＾'));
		if (gzflag($cook_uid,$uid) != -1){
			$returngz = gzflag($uid,$cook_uid);
			if ($returngz == -1){
				$db->query("UPDATE ".__TBL_GZ__." SET flag=1 WHERE uid=".$uid." AND senduid=".$cook_uid);
			}elseif($returngz == 0){
				$db->query("INSERT INTO ".__TBL_GZ__."(uid,senduid,px) VALUES ($uid,$cook_uid,".ADDTIME.")");
			}
		}
		json_exit(array('flag'=>1,'msg'=>'关注成功'));
	break;
	case 'ajax_gz0':
		if ($uid == $cook_uid)json_exit(array('flag'=>0,'msg'=>'亲！操作自己有意义么'));
		$rowtx = $db->NUM($uid,"sex");if ($rowtx){$sex= $rowtx[0];}else{exit(JSON_ERROR);}
		if($cook_sex==$sex)json_exit(array('flag'=>0,'msg'=>'同性不能操作＾_＾'));
		//
		$returngz = gzflag($uid,$cook_uid);
		if ($returngz == 1)$db->query("DELETE FROM ".__TBL_GZ__." WHERE uid=".$uid." AND senduid=".$cook_uid);
		json_exit(array('flag'=>1,'msg'=>'取消成功'));
	break;
	//index_more_big.php end
	case 'ajax_agree':
		$db->query("UPDATE ".__TBL_USER__." SET agree=agree+1 WHERE id=".$uid);
		json_exit(array('flag'=>1,'msg'=>'点赞成功'));
	break;
	case 'ajax_inblack':
		if ($uid == $cook_uid)json_exit(array('flag'=>0,'msg'=>'你想干嘛，将自己拉黑？'));
		$returngz = gzflag($uid,$cook_uid);
		$F = 1;$C = '拉黑成功，对方将不能联系你';
		if($returngz == 0){
			$db->query("INSERT INTO ".__TBL_GZ__."(uid,senduid,flag) VALUES ($uid,$cook_uid,-1)");
		}elseif($returngz == -1){
			$db->query("DELETE FROM ".__TBL_GZ__." WHERE uid=".$uid." AND senduid=".$cook_uid);
			$F = 0;$C = '已取消拉黑';
		}elseif($returngz == 1){
			$db->query("UPDATE ".__TBL_GZ__." SET flag=-1 WHERE uid=".$uid." AND senduid=".$cook_uid);
		}
		json_exit(array('flag'=>$F,'msg'=>$C));
	break;
	case 'ajax_photo_s_zoom':nophoto_s($cook_uid);break;
	case 'ajax_Plist_zoom':nophoto($cook_uid);break;
	case 'ajax_gift_div':
		if(!ifint($gid) && $gid!=0)exit(JSON_ERROR);
		$SQL = ($gid == 0)?" ORDER BY rand() LIMIT 1":" WHERE id=".$gid;
		$rt=$db->query("SELECT id,title,price,picurl FROM ".__TBL_GIFT__.$SQL);
		if ($db->num_rows($rt)){
			$row = $db->fetch_array($rt,'name');
			$row['title']  = dataIO($row['title'],'out');
			$row['picurl'] = UP.$row['picurl'];
			$G = $row;
		}else{json_exit(array('flag'=>0));}
		$U = $db->NAME($uid,"nickname,sex");
		if ($U){
			$U['nickname'] = dataIO($U['nickname'],'out');
		}else{json_exit(array('flag'=>0));}
		$GU = array_merge($G,$U);
		json_exit($GU);
	break;
	case 'ajax_gift_send':
		if(!ifint($gid))exit(JSON_ERROR);
		if ($cook_uid == $uid)json_exit(array('flag'=>0,'msg'=>'不能给自己送礼物哦～'));
		if(@!in_array('gift',$navarr))json_exit(array('flag'=>0,'msg'=>'礼物商店已打烊～'));
		$rowtx = $db->NUM($uid,"sex,nickname,openid");
		if ($rowtx){$sex= $rowtx[0];$nickname = trimhtml(dataIO($rowtx[1],'out'));$openid = $rowtx[2];}else{exit(JSON_ERROR);}
		//if($cook_sex==$sex)json_exit(array('flag'=>0,'msg'=>'同性不能操作＾_＾'));
		$G = $db->ROW(__TBL_GIFT__,"title,price","id=".$gid,'num');
		if ($G){
			$title = dataIO($G[0],'out');
			$price = intval($G[1]);
			if ($price > $cook_loveb){
				json_exit(array('flag'=>'noloveb','title'=>$_ZEAI['loveB'].'账户余额不足','msg'=>'您当前账户余额：'.$cook_loveb.'<br>当前礼物价值'.$price.$_ZEAI['loveB'].'，请充值','jumpurl'=>$jumpurl));
			} else {
				$db->query("INSERT INTO ".__TBL_GIFT_USER__." (gid,uid,senduid,addtime) VALUES ($gid,$uid,$cook_uid,".ADDTIME.")");
				$guid = $db->insert_id();
				$content = '给你送了个（'.$title.'）请查收';
				$db->query("INSERT INTO ".__TBL_TIP__."  (uid,senduid,content,remark,kind,addtime) VALUES ($uid,$cook_uid,'$content',$guid,2,".ADDTIME.")");
				$db->query("UPDATE ".__TBL_USER__." SET tipnum=tipnum+1 WHERE id=".$uid);
				$endnum=$cook_loveb-$price;
				$db->query("UPDATE ".__TBL_USER__." SET loveb=$endnum WHERE id=".$cook_uid);
				//爱豆清单入库
				$db->AddLovebRmbList($cook_uid,'赠送礼物uid:'.$uid,-$price,'loveb',9);		
				//通知
				if (!empty($openid)){
					$F = urlencode($nickname."您好，".$cook_nickname."送了个礼物给你(".YmdHis(ADDTIME).")");
					$C = urlencode('礼物【'.$title.'】，价值'.$price.$_ZEAI['loveB']);
					@wx_mb_sent('mbbh=ZEAI_ACCOUNT_IN&openid='.$openid.'&num='.$price.'&first='.$F.'&content='.$C.'&url='.urlencode(HOST.'/?z=my&e=my_gift'));
				}
				//
				$SQLgift2 = ",(SELECT MAX(id) AS max_id FROM ".__TBL_GIFT_USER__." WHERE uid=".$uid." GROUP BY gid) C";
				$rt=$db->query("SELECT B.id,B.picurl FROM ".__TBL_GIFT_USER__." A,".__TBL_GIFT__." B ".$SQLgift2." WHERE A.id=max_id AND A.uid=".$uid." AND A.gid=B.id GROUP BY A.gid ORDER BY A.id DESC LIMIT 3");
				$total = $db->num_rows($rt);
				if ($total>0){
					$gstr='';
					for($i=1;$i<=$total;$i++) {
						$rows = $db->fetch_array($rt,'num');
						if(!$rows) break;
						$gid    = $rows[0];
						$picurl = UP.$rows[1];
						$gnum = $db->COUNT(__TBL_GIFT_USER__,"uid=".$uid." AND gid=".$gid);
						$gnum_str = ($gnum > 0)?'<b>X'.$gnum.'</b>':'';
						$gstr .= '<li gid=\''.$gid.'\'><img src=\''.$picurl.'\'>'.$gnum_str.'</li>';
					}
					$giftotalnum=$db->COUNT(__TBL_GIFT_USER__,"uid=".$uid);
				}
				json_exit(array('flag'=>1,'giftotalnum'=>$giftotalnum,'C'=>$gstr));
			}
		}else{exit(JSON_ERROR);}
	break;
	case 'ajax_clickloveb':
		clickloveb($cook_uid,$uid,$kind);//单次点击扣币
	break;
	case 'ajax_senddzh':hiFn($uid,$hi_text);break;
}
/*用户UID读库*/
$fields = "magapp_uid,hnbbs,ifadm,chatHiContact_iftips,flag,id,uname,grade,photo_f,RZ,myinfobfb,kind,mob_ifshow,weixin,weixin_pic,photo_ifshow,xqk_ifshow,regtime,endtime,admid,ifViewPush,openid,subscribe,agree";
$fields.=",".udata_arr('all','userF').',areatitle,area2title,mate_other,sign_pdf_path,sign_pdf_flag,'.get_mate_fld('list');
$row = $db->ROW(__TBL_USER__,$fields,"(flag=1 OR flag=-2) AND id=".$uid);
if ($row){
	$Urow       = $row;
	$Uifadm     = $row['ifadm'];
	$chatHiContact_iftips=$row['chatHiContact_iftips'];
	$flag       = $row['flag'];
	$magapp_uid = $row['magapp_uid'];
	$openid     = $row['openid'];
	$subscribe  = $row['subscribe'];
	$ifViewPush = intval($row['ifViewPush']);
	$uname      = trimhtml(dataIO($row['uname'],'out'));
	$nickname   = trimhtml(dataIO($row['nickname'],'out'));
	$nickname = (empty($nickname))?'uid:'.$uid:$nickname;
	$sex        = $row['sex'];
	$grade      = $row['grade'];
	$admid      = intval($row['admid']);
	$Smode_g    = 'g_'.$grade;
	$photo_s    = $row['photo_s'];
	$photo_f    = $row['photo_f'];
	$RZ         = $row['RZ'];$RZarr=explode(',',$RZ);
	$myinfobfb  = $row['myinfobfb'];
	$regtime    = YmdHis($row['regtime']);
	$endtime    = YmdHis($row['endtime']);
	$agree      = $row['agree'];
	$mob        = trimhtml(dataIO($row['mob'],'out'));
	$weixin     = trimhtml(dataIO($row['weixin'],'out'));
	$qq         = trimhtml(dataIO($row['qq'],'out'));
	$weixin_pic = $row['weixin_pic'];
	$mob_ifshow = $row['mob_ifshow'];
	$ifcontact  = (!empty($weixin)  || !empty($qq) || !empty($weixin_pic) || (ifmob($mob) && $mob_ifshow==1)  )?true:false;
	$Ukind      = $row['kind'];
	$aboutus    = dataIO($row['aboutus'],'out');
	$hnbbs      = dataIO($row['hnbbs'],'out');
	$birthday   = $row['birthday'];
	$birthday   = (!ifdate($birthday))?'':$birthday;
	$areatitle  = dataIO($row['areatitle'],'out');
	$area2title = dataIO($row['area2title'],'out');
	$heigh      = $row['heigh'];
	$weigh      = $row['weigh'];
	$love       = $row['love'];
	$child      = $row['child'];
	$marrytime  = $row['marrytime'];
	$edu        = $row['edu'];
	$pay        = $row['pay'];
	$job        = $row['job'];
	$house      = $row['house'];
	$nation     = $row['nation'];
	$car        = $row['car'];
	$photo_ifshow= $row['photo_ifshow'];
	$xqk_ifshow= $row['xqk_ifshow'];
	$sign_pdf_path= $row['sign_pdf_path'];
	$sign_pdf_flag= $row['sign_pdf_flag'];
	$parent     = (empty($row['parent']))?1:$row['parent'];
	$mate_other = trimhtml(dataIO($row['mate_other'],'out'));
	if($Uifadm==1){
		$parent_str = '<div class="bangadm">工作人员</div>';
	}else{
		$parent_str = udata('parent',$parent);
	}
	if($Ukind==2)$parent_str='<div class="bang">线下用户</div>';
	//$sextitle = ($sex == 2)?'她':'他';
}else{
	zeaialert('{"title":"'.$noustr.'","btnt":"我知道了","url":"-1"}');
}
/*用户筛出处理*/
$db->query("UPDATE ".__TBL_USER__." SET click=click+1 WHERE id=".$uid);
if($grade>1)zeai_chk_ugrade($uid);
/*照片权限*/
$photo_flag=photo_s_out('{"sex":"'.$sex.'","photo_s":"'.$photo_s.'","photo_f":"'.$photo_f.'","photo_ifshow":"'.$photo_ifshow.'","uflag":"'.$uflag.'","outkind":"flag"}');
if (!empty($photo_s) && $photo_f == 1){
	$photo_s_url = UP.$photo_s;
	$photo_m_url = smb($photo_s_url,'m');
	$photo_b_url = smb($photo_s_url,'b');
	$photo_blur_url = smb($photo_s_url,'blur');
	$photo_s_str = '<img src="'.$photo_s_url.'">';
	$photo_m_str = '<img src="'.$photo_m_url.'">';
	$Parr = @getimagesize($photo_m_url);$w = $Parr[0];$h = $Parr[1];
}else{
	$photo_s_url = RES.'photo_m'.$sex.'.png';
	$photo_m_url = $photo_s_url;
	$photo_b_url = RES.'m_b'.$sex.'.jpg';
	$photo_s_str = '<img src="'.$photo_s_url.'">';
	$photo_blur_url = RES.'m/img/photo_blur.jpg';
	$photo_m_str = '<img src="'.RES.'photo_m'.$sex.'.png">';
}
$ifblur=0;$lockstr='';
if(!$photo_flag){
	$photo_s_url = smb($photo_s_url,'blur');
	$photo_m_url = $photo_s_url;
	$photo_b_url = $photo_s_url;
	$photo_s_str = '<img src="'.$photo_s_url.'" style="width:100%;height:100%">';
	$photo_m_str = '<img src="'.$photo_m_url.'">';
	$ifblur=1;
	$lockstr = '<div class="lockstr"><font>'.dataIO($switch['grade1LockBlurT'],'out').'</font><a href="my_vip.php?jumpurl='.urlencode($jumpurl).'" class="ico">&#xe6ab; 立即开通</a></div>';
}
if($photo_ifshow==0 && $ifblur==0){
	$photo_s_url = smb($photo_s_url,'blur');
	//$photo_m_url =RES.'photo_m'.$sex.'_hide.png';
	$photo_m_url =$photo_s_url;
	$photo_b_url = $photo_s_url;
	$photo_s_str = '<img src="'.$photo_s_url.'" style="width:100%;height:100%">';
	$photo_m_str = '<img src="'.$photo_m_url.'">';
	$lockstr = '';
}
/*照片权限 END*/
$sex_str = ($sex == 1)?'他':'她';
$sex_str2 = ($sex == 1)?'男':'女';
$gzclass='';$gz_ico='&#xe61c;';
/*AI和是否关注，黑名单，是否打招呼处理*/
$ifhiher=true;
if (ifint($cook_uid)){
	$cook_SQL=($_ZEAI['m_mb_u']==2)?",".MATE_DIY_F:"";
	$row = $db->ROW(__TBL_USER__,"sex,grade,areaid,areatitle,ifadm,admid,weixin,mob,hh_num".$cook_SQL,"id=".$cook_uid,"name");
	if ($row){
		$mateROW=$row;
		$cook_sex  = $row['sex'];
		$cook_grade= $row['grade'];if($cook_grade>1)zeai_chk_ugrade($cook_uid);
		$areaid    = $row['areaid'];
		$robot=json_decode($_ZEAI['robot'],true);
		if($Ukind==4 && $robot['areaupdate']==1 && !empty($areaid)){
			$areatitle= $row[3];
			$db->query("UPDATE ".__TBL_USER__." SET areaid='$areaid',areatitle='$areatitle' WHERE id=".$uid);
		}
		$cook_ifadm = $row['ifadm'];
		$cook_admid = $row['admid'];
		$cook_weixin = trimhtml(dataIO($row['weixin'],'out'));
		$cook_mob    = trimhtml($row['mob']);
		$cook_hh_num = $row['hh_num'];
	}
	if (gzflag($uid,$cook_uid) == 1){$gzclass=' class="ed"';$gz_ico='&#xe62b;';}
	$inblackclass = (gzflag($uid,$cook_uid) == -1)?' class="ed"':'';
	$ifhiher = ($db->COUNT(__TBL_TIP__," senduid=".$cook_uid." AND uid=".$uid." AND kind=3") > 0)?false:true;
}
//扫黑除恶
$chcis=$switch['chatHiContact_ifshow'];$chcis_if=true;
$chcit=intval($switch['chatHiContact_iftips']);
if(!empty($chcis) && @is_array($chcis) && @count($chcis)>0){
	if(@in_array('mob',$chcis) && !in_array('mob',$RZarr))$chcis_if=false;
	if(@in_array('identity',$chcis) && !in_array('identity',$RZarr))$chcis_if=false;
	if(@in_array('photo',$chcis) && !in_array('photo',$RZarr))$chcis_if=false;
	if(@in_array('store',$chcis) && !in_array('store',$RZarr))$chcis_if=false;
}
//访问记录
$shuaxin_homeclick = 'homeclick'.$uid.$cook_uid;
if ( $cook_uid != $uid && ifint($cook_uid) && $_COOKIE["$shuaxin_homeclick"] != 'wwwZEAIcn' && $cook_ifadm!=1) {
	$vnum = $db->COUNT(__TBL_CLICKHISTORY__,"uid=".$uid." AND senduid=".$cook_uid);
	if ($vnum == 0 && $admid<>$cook_uid){
		$db->query("INSERT INTO ".__TBL_CLICKHISTORY__."  (uid,senduid,addtime) VALUES ($uid,$cook_uid,".ADDTIME.")");
		$ifViewPushsex_=true;
		if($_VIP['ifViewPushsex']==1 && $sex==2){
			$ifViewPushsex_=false;
		}elseif($_VIP['ifViewPushsex']==2 && $sex==1){
			$ifViewPushsex_=false;
		}
		if ($ifViewPush==1 && !empty($openid) && $subscribe==1 && $ifViewPushsex_ && $cook_sex!=$sex || ifint($magapp_uid)){
			$mbnickname = urlencode($cook_nickname);
			$first  = urlencode("您好，在 ".date("Y-m-d H:i:s",ADDTIME)." 收到新访客！");
			$remark = urlencode("用户【".$mbnickname." ID:".$cook_uid."】正在浏览您的个人资料，缘份就在一瞬间，赶快看看TA的资料，好就别错过啦！");
			$mbcontent = '通知';
			@wx_mb_sent('mbbh=ZEAI_MSG_CHAT&magapp_uid='.$magapp_uid.'&openid='.$openid.'&content='.$mbcontent.'&nickname='.$mbnickname.'&first='.$first.'&remark='.$remark.'&url='.urlencode(mHref('u',$cook_uid)));
		}
	}else{
		$db->query("UPDATE ".__TBL_CLICKHISTORY__." SET addtime=".ADDTIME." WHERE uid=".$uid." AND senduid=".$cook_uid);
	}
	setcookie("$shuaxin_homeclick",'wwwZEAIcn',time()+7200000,"/",$_ZEAI['CookDomain']);
}
/*地区分享说明处理*/
$sext=($sex==1)?'【帅哥想脱单】':'【美女想脱单】';
$areatitleArr = explode(' ',$areatitle);
$areatitle2=$areatitleArr[1];
$areatitle3=$areatitleArr[2];
$areatitle3=(empty($areatitle3))?$areatitle2:$areatitle3;
$age=getage($birthday);
$age_str=($age>0)?$age.'岁':'';
$share_u_title = $sext.$nickname.'.'.$age_str.'.'.udata('heigh',$heigh).'.';
$share_u_desc  = trimhtml($_INDEX['indexContent']);
$area_s_title  = explode(' ',$areatitle);
$area_s_title1 = $area_s_title[1];
$area_s_title2 = $area_s_title[2];
$area_s_title  = $area_s_title1.$area_s_title2;
$area_s_title2 = explode(' ',$area2title);
$area_s_title2 = $area_s_title2[2].$area_s_title2[3];
//择偶要求
$mate_diy = explode(',',$_ZEAI['mate_diy']);
if (count($mate_diy) >= 1 && is_array($mate_diy)){
	$mate_li_out='';
	foreach ($mate_diy as $F) {
		$ext = mate_diy_par($F,'ext');
		switch ($ext) {
			case 'radio':
				$D     = intval($Urow['mate_'.$F]);
				$D_str = (ifint($D))?udata($F,$D):'';
				if(ifint($D)){
					$D_str = udata($F,$D);
					//switch ($F) {
					//	case 'edu':$D_str = '最低'.$D_str;break;
					//	case 'pay':$D_str = '最低月薪'.$D_str;break;
					//}
				}else{$D_str='';}
			break;
			case 'radiorange':
				$D1     = intval($Urow['mate_'.$F.'1']);
				$D2     = intval($Urow['mate_'.$F.'2']);
				$D      = $D1.','.$D2;
				$dwarr  = json_decode($_UDATA[$F],true);$dw = $dwarr['dw'];
				$D_str  = (ifint($D1) || ifint($D2))?mateset_out($D1,$D2,$dw):'';
				$D_str  = str_replace("不限","",$D_str);
			break;
			case 'checkbox':
				$D     = $Urow['mate_'.$F];
				$D_str = (!empty($D))?udata($F,$D):'';
			break;
			case 'area':
				switch ($F) {
					case 'areaid':
						$D_t = str_replace("不限","",$Urow['mate_areatitle']);
						$D_str = (!empty($D_t))?$D_t:'';
					break;
					case 'areaid2':
						$D_t = str_replace("不限","",$Urow['mate_areatitle2']);
						$D_str = (!empty($D_t))?$D_t:'';
					break;
				}
			break;
		}
		if(!empty($D_str))$mate_li_out.='<li>'.$D_str.'</li> ';//<b>'.mate_diy_par($F,'title').'：</b>
	}
	if(!empty($mate_other))$mate_li_out.='<li>其他要求：'.$mate_other.'</li>';
}
//择偶要求 结束
$rz_dataARR = explode(',',$_ZEAI['rz_data']);
//联系方式
$urolenew = json_decode($_ZEAI['urole'],true);
$newarr=array();foreach($urolenew as $RV){if($RV['f']==1){$newarr[]=$RV;}else{continue;}}
$newarr=encode_json($newarr);
$urole = json_decode($newarr);
$contact_daylooknum = json_decode($_VIP['contact_daylooknum']);
$chat_daylooknum = json_decode($_VIP['chat_daylooknum']);
$contact_loveb   = json_decode($_VIP['contact_loveb']);
$ARR = json_decode($_VIP['contact_daylooknum'],true);
$ifShowContact=false;
if (count($ARR) >= 1 && is_array($ARR) && max($ARR)>0 ){
	$ifShowContact=true;
}
if($switch['Smode'][$Smode_g] == 1 && $Ukind!=2 ){// && $chcis_if
	$ifShowContact=true;
}else{
	$ifShowContact=false;
}
$ifcontact=($ifShowContact && $ifcontact && in_array('contact',$navarr) && $cook_uid!=$uid)?true:false;
$ifcontact_hh=(in_array('contact_hh',$navarr) && $Ukind!=2 && $switch['Smode'][$Smode_g] == 1)?true:false;
//联系方式 结束
$ifchat = ($switch['Smode'][$Smode_g] == 1 && $Ukind!=2 && in_array('chat',$navarr) && $cook_uid!=$uid)?true:false;
$ifhn   = (in_array('hn',$navarr) && $cook_uid!=$uid)?true:false;
$iflx_alloff = (!$ifchat && !$ifcontact && !$ifhn && !$ifcontact_hh)?true:false;
$ifgift=(in_array('gift',$navarr) && $Ukind!=2)?true:false;
$ifhi=($ifhiher && in_array('hi',$navarr)&&$Ukind!=2 && $cook_uid!=$uid)?true:false;
$kf_tel=dataIO($_ZEAI['kf_tel'],'out');$kf_mob=dataIO($_ZEAI['kf_mob'],'out');$kf_wxpic=dataIO($_ZEAI['kf_wxpic'],'out');
/*主体开始*/?>
<!doctype html><html><head><meta charset="utf-8">
<title><?php echo $share_u_title.$_ZEAI['siteName'];?></title>
<?php echo HEADMETA; ?>
<meta name="generator" content="Zeai.cn V9" />
<link href="<?php echo RES;?>m/css/m.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
<link href="<?php echo RES;?>m/css/u.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
<?php if($_ZEAI['m_mb_u']==2){?><link href="<?php echo RES;?>m/css/u2.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" /><?php }?>
<link href="<?php echo HOST;?>/cache/zeaicolor.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
<script src="<?php echo RES;?>www_zeai_cn.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<script src="<?php echo RES;?>m/js/m.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<script>var uid=<?php echo $uid;?>,browser='<?php echo browser();?>',lovebstr='<?php echo $_ZEAI['loveB'];?>';</script>
<script src="<?php echo RES;?>m/js/u.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<?php if (is_weixin()){
	require_once ZEAI."api/weixin/jssdk.php";
	$share_u_title = $share_u_title.$_ZEAI['siteName'];?>
	<script src="<?php echo RES;?>jweixin-1.2.0.js"></script>
	<script>wx.config({debug:false,appId: '<?php echo $signPackage["appId"];?>',timestamp: <?php echo $signPackage["timestamp"];?>,nonceStr: '<?php echo $signPackage["nonceStr"];?>',signature: '<?php echo $signPackage["signature"];?>',jsApiList:['hideMenuItems','onMenuShareTimeline','onMenuShareAppMessage','onMenuShareQQ','onMenuShareWeibo']});
	var share_u_title = '<?php echo $share_u_title; ?>',share_u_desc='<?php echo $share_u_desc; ?>',share_u_link='<?php echo $jumpurl; ?>',share_u_imgurl='<?php echo $photo_s_url; ?>';
	wx.ready(function () {
		wx.onMenuShareAppMessage({title:share_u_title,desc:share_u_desc,link:share_u_link,imgUrl:share_u_imgurl});
		wx.onMenuShareTimeline({title:share_u_title,desc:share_u_desc,link:share_u_link,imgUrl:share_u_imgurl});
	});
    </script>
<?php }?>
</head><body>
<?php
/*****管理员*****/
if ($cook_ifadm == 1 && ifint($cook_uid)){?>
<div id="ifadmbtn">管理用户</div>
<div id="ifadmbox">
	<div class="btnli">
        <button type="button" class="btn size3 BAI" onclick="admuFn('top',<?php echo $uid;?>)">置顶</button>
        <button type="button" class="btn size3 BAI" onclick="admuFn('bottom',<?php echo $uid;?>)">置底</button>
        <button type="button" class="btn size3 BAI" onclick="admuFn('flag_2',<?php echo $uid;?>)"><?php echo ($flag==-2)?'<font class="S12">取消隐藏</font>':'隐藏';?></button>
        <button type="button" class="btn size3 BAI" onclick="admuFn('flag_1',<?php echo $uid;?>)">封号</button>
    </div>
    <div class="clear"></div>
	<div class="embox">
		<?php if (!empty($mob)){?><em><a href="tel:<?php echo $mob;?>"><i class="ico mob">&#xe627;</i> <span><?php echo $mob;?></span></a><b class="btn size1 BAI" onclick="zeai.copy('<?php echo $mob;?>',function(){zeai.msg('手机复制成功');})">复制</b></em><?php }?>
        <?php if (!empty($weixin)){?><em><i class="ico weixin">&#xe607;</i> <span><?php echo $weixin;?></span><b class="btn size1 BAI" onclick="zeai.copy('<?php echo $weixin;?>',function(){zeai.msg('微信号复制成功');})">复制</b></em><?php }?>
		<?php if (!empty($weixin_pic)){?><em><i class="ico ewm">&#xe62e;</i><img src="<?php echo UP.$weixin_pic;?>" onClick="ZeaiM.piczoom('<?php echo UP.$weixin_pic;?>');"> <span><font class="C999">←</font> <font class="C999 S12">点击扫码加用户微信</font></span></em><?php }?>
    </div>
	<a href="tg_my_ucard.php?submitok=tg_my_ucard_list&uid=<?php echo $uid;?>" class="btn size3 HONG2 xqk"><i class="ico">&#xe6b6;</i> 生成用户相亲卡</a>
	<a onclick="utext('<?php echo get_udata_text($uid);?>');" class="btn size3 LAN xqk"><i class="ico">&#xe68f;</i> 生成用户文本卡</a>
</div>
<?php }
/*****隐藏用户显示*****/
if ($flag == -2){?>
    <style>body{background-color:rgba(<?php echo c16_rgb($_ZEAI['mob_mbcolor']);?>,.1)}</style>
    <div class="photo_hidebox">
        <img src="<?php echo RES.'photo_m'.$sex.'_hide.png';?>" class="photo_m_hide" />
        <h4>ID：<?php echo $uid;?></h4>
        <h3 class="zeaicolor">用户已隐藏，加客服联系Ta</h3>
        <?php if (!empty($kf_wxpic)){?><img src="<?php echo UP.$kf_wxpic;?>" class="ewm"><font>长按或扫码加客服微信</font><?php }?>
        <?php if (!empty($kf_tel)){?><a href="tel:<?php echo $kf_tel;?>"><i class="ico">&#xe7c1;</i> <?php echo $kf_tel;?></a><?php }else{?>
        <?php if (!empty($kf_mob)){?><a href="tel:<?php echo $kf_mob;?>"><i class="ico">&#xe7c1;</i> <?php echo $kf_mob;?></a><?php }}?>
        <a href="<?php echo HOST;?>" class="btn size4 zeaibg yuan"><i class="ico">&#xe62f;</i> 进入缘分大厅</a>
    </div>
	<script src="<?php echo RES;?>m/js/u.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<?php exit;}if($_ZEAI['m_mb_u']==2){require_once ZEAI.'m/u2.php';exit;}?>
<a class="UgobackFix"><i class='ico' onclick="zeai.back()">&#xe602;</i></a>
<div class="Ublack" id="Ublack"<?php if ($cook_uid == $uid && ifint($cook_uid) && $ifmy==1)echo' style="display:none"';?>><i class="ico">&#xe642;</i></div>
<em id="rtbox"><a href="<?php echo HOST;?>"><i class="ico">&#xe7a0;</i>首页</a><a href="<?php echo a('{"kind":"my","mp":"m"}');?>"><i class="ico">&#xe645;</i>我的</a><a<?php echo $inblackclass; ?>><i class="ico">&#xe692;</i>拉黑</a><a href="315.php?uid=<?php echo $uid;?>&jumpurl=<?php echo urlencode($jumpurl);?>"><i class="ico">&#xe631;</i>举报</a></em>
<style>
header{background:url("<?php echo $photo_blur_url; ?>")top center / cover no-repeat}
header .photo_m .parent,#hnbox dl dt div.admid .hnpic b{background-color:rgba(<?php echo c16_rgb($_ZEAI['mob_mbcolor']);?>,.8)}
.nicknamebox .nickname span{background-color:<?php echo $_ZEAI['mob_mbcolor'];?>}
.udata ul li,.umate ul li{background-color:rgba(<?php echo c16_rgb($_ZEAI['mob_mbcolor']);?>,.04);border-color:rgba(<?php echo c16_rgb($_ZEAI['mob_mbcolor']);?>,.2)}
.udata ul li.more{color:<?php echo $_ZEAI['mob_mbcolor'];?>;}
.ugift ul li:first-child{background-color:<?php echo $_ZEAI['mob_mbcolor'];?>}
.btmbox a,#rtbox{background-color:<?php echo $_ZEAI['mob_mbcolor'];?>}
#rtbox a:nth-child(2),#rtbox a:nth-child(3){border-color:rgba(255,255,255,.3)}
.btmbox a i,#rtbox:after,#hnbox dl{color:<?php echo $_ZEAI['mob_mbcolor'];?>}
#hi_handbox ul li.ed,#hi_handbox ul li:hover{background-color:rgba(<?php echo c16_rgb($_ZEAI['mob_mbcolor']);?>,.1);color:<?php echo $_ZEAI['mob_mbcolor'];?>}
#hi_handbox button,#hnbox button{box-shadow:0 3px 8px rgba(<?php echo c16_rgb($_ZEAI['mob_mbcolor']);?>,.4)}
.chcit{background-color:rgba(<?php echo c16_rgb($_ZEAI['mob_mbcolor']);?>,0.5)}
.chcit #chcit{background-color:<?php echo $_ZEAI['mob_mbcolor'];?>}
.cert .detail{border:rgba(<?php echo c16_rgb($_ZEAI['mob_mbcolor']);?>,.08) 1px solid;background-color:rgba(<?php echo c16_rgb($_ZEAI['mob_mbcolor']);?>,.02)}
#gz.ed, #agree.ed{background-color:rgba(<?php echo c16_rgb($_ZEAI['mob_mbcolor']);?>,.7);}
</style>
<header>
    <div class="photo_m" id="photo_m"><?php echo $photo_m_str;?><div class="parent"><?php echo $parent_str;?></div></div>
    <div class="nicknamebox"><div class="nickname"><?php echo uicon($sex.$grade,2);?><font><?php echo $nickname;?></font><div><?php echo utitle($grade);?></div></div></div>
    <div id="gz"<?php echo $gzclass; ?>><font>喜欢</font><i class="ico"><?php echo $gz_ico;?></i></div>
    <div id="agree"><i class="ico">&#xe652;</i><font><?php echo $agree;?></font></div>
</header>
<?php 
//防骗/防托设置
if ($chcit == 1 && !$chcis_if && $Ukind!=2 && ifint($cook_uid) && $cook_uid!=$uid){
	$chcit_listr=(@in_array('mob',$chcis) && !in_array('mob',$RZarr))?'【'.RZtitle('mob').'】':'';
	if(empty($chcit_listr))$chcit_listr.=(@in_array('identity',$chcis) && !in_array('identity',$RZarr))?'【'.RZtitle('identity').'】':'';
	if(empty($chcit_listr))$chcit_listr.=(@in_array('photo',$chcis) && !in_array('photo',$RZarr))?'【'.RZtitle('photo').'】':'';
	if(empty($chcit_listr))$chcit_listr.=(@in_array('store',$chcis) && !in_array('store',$RZarr))?'【'.RZtitle('store').'】':'';?>
	<div class="chcit zeaibg">此用户未完成<?php echo $chcit_listr;?> <button id="chcit">提醒对方认证</button></div><?php
}
//礼物
if($ifgift){?>
<div class="ugift ubox">
    <?php $gifnum=$db->COUNT(__TBL_GIFT_USER__,"uid=".$uid); ?>
    <ul id="gift">
    <li gid="0" uid="<?php echo $uid; ?>"><i class="ico">&#xe600;</i><?php if ($gifnum>0){?><font>收到<?php echo $gifnum;?>份</font><?php }?></li>
    <?php 
    $SQLgift2 = ",(SELECT MAX(id) AS max_id FROM ".__TBL_GIFT_USER__." WHERE uid=".$uid." GROUP BY gid) C";
    $rt=$db->query("SELECT B.id,B.picurl FROM ".__TBL_GIFT_USER__." A,".__TBL_GIFT__." B ".$SQLgift2." WHERE A.id=max_id AND A.uid=".$uid." AND A.gid=B.id GROUP BY A.gid ORDER BY A.id DESC LIMIT 3");
    $total = $db->num_rows($rt);
    if ($total==0){
        echo '<em>缘分，从送第一份礼物开始认识！</em>';
    }else{
        for($i=1;$i<=$total;$i++) {
            $rows = $db->fetch_array($rt,'num');
            if(!$rows) break;
            $gid    = $rows[0];
            $picurl = UP.$rows[1];
            $gnum = $db->COUNT(__TBL_GIFT_USER__,"uid=".$uid." AND gid=".$gid);
            $gnum_str = ($gnum > 0)?'<b>X'.$gnum.'</b>':'';
            echo '<li gid="'.$gid.'"><img src="'.$picurl.'">'.$gnum_str.'</li>';
        }
    }
    ?>
    <div class="clear"></div>
    </ul>
</div>
<div class="clear"></div>
<?php }else{echo '<div class="uline "></div>';}
//相册
$rt=$db->query("SELECT path_s FROM ".__TBL_PHOTO__." WHERE uid=".$uid." AND flag=1 ORDER BY id DESC LIMIT 8");
$photo_total = $db->num_rows($rt);
if ($photo_total>0) {
    echo '<div class="uPlist" id="Plist"><div class="box">';
    $pic_list = array();
    for($i=1;$i<=$photo_total;$i++) {
        $rows = $db->fetch_array($rt);
        if(!$rows) break;
        $path_s   = $rows[0];
        $dst_s    = UP.$path_s;
        $dst_b    = smb($dst_s,'b');
        $blursty=($ifblur==1)?' class="blur"':'';
        if($photo_ifshow==0){
			$dst_s=RES.'photo_m'.$sex.'_hide.png?'.$_ZEAI['cache_str'];	
			$pic_list[]= $dst_s;
		}else{
			$pic_list[]= $dst_b;
		}
        echo '<img src="'.$dst_s.'"'.$blursty.'>';
    }
    $pic_list = encode_json($pic_list);
    echo '</div>';
    if($ifblur==1)echo $lockstr;
    echo '</div>';
}
if(@in_array('identity',$rz_dataARR) && $Ukind!=2){?>
<div class="ubox cert">
    <h3 class="zeaicolor" id="ucert">诚信认证</h3>
    <div class="detail<?php if(@!in_array('identity',$RZarr)){echo ' detail_blur';}?>">
        <dt>
            <span>姓　　名：***<font> （信息已保密）</font></span>
            <span>身份证号：**** **** **** **** **</span>
            <span>手机号码：*** **** ****</span>
        </dt>
        <dd><img src="<?php echo RES;?>cert_sex<?php echo $sex;?>.gif"><span><i class="ico">&#xe60f;</i> 已通过认证</span></dd>
        <?php if(@!in_array('identity',$RZarr)){?><h5>此用户未完成【实名认证】 <a href="javascript:chcitFn2();" class="zeaibg" id="chcit2">提醒对方认证</a></h5><?php }
        if (count($rz_dataARR)>0 && is_array($rz_dataARR) && !empty($RZ)){?>
            <div class="ucert2" onClick="ucertFn();"><?php foreach ($rz_dataARR as $k=>$V){
                $rztitle=str_replace("认证","",rz_data_info($V,'title'));?>
                <li class="rz <?php echo (in_array($V,$RZarr))?' ed':'';?>"><i class="ico <?php echo $V;?>"<?php echo (in_array($V,$RZarr))?RZbg($V):'';?>><?php echo rz_data_info($V,'ico');?></i></li><?php }?>
                <div class="clear"></div>
            </div>
        <?php }?>
    </div>
</div>
<?php }?>
<div class="uline"></div>
<div class="ubox udata">
    <h3 id="mydata" class="zeaicolor">个人资料<font>ID：<?php echo $uid;?></font></h3>
    <ul>
        <li><?php echo $sex_str2;?></li>
        <?php if (!empty($birthday) && $birthday!='0000-00-00'){?><li><?php echo getage($birthday);?>岁</li><?php }?>
        <?php if (!empty($birthday) && $birthday!='0000-00-00'){?>
            <li>属<?php echo getbirthpet($birthday);?></li>
            <li><?php echo getstar($birthday);?></li>
        <?php }?>
        <?php if (!empty(udata('love',$love))){?><li><?php echo udata('love',$love);if (!empty($child)){?>(<?php echo udata('child',$child);?>)<?php }?></li><?php }?>
        <?php if (!empty($areatitle)){?><li>在<?php echo $area_s_title;?>工作</li><?php }?>
        <?php if (!empty($area2title)){?><li>户籍：<?php echo $area_s_title2;?></li><?php }?>
        <?php if (!empty($heigh)){?> <li><?php echo udata('heigh',$heigh);?></span></li><?php }?>
        <?php if (!empty($weigh)){?> <li><?php echo udata('weigh',$weigh);?></span></li><?php }?>
        <?php if (!empty($edu)){?><li>学历<?php echo udata('edu',$edu);?></li><?php }?>
        <?php if (!empty($pay)){?><li>月收入<?php echo udata('pay',$pay);?></li><?php }?>
        <?php if (!empty($job)){?><li><?php echo udata('job',$job);?></li><?php }?>
        <?php if (!empty($house)){?><li><?php echo udata('house',$house);?></li><?php }?>
        <?php if (!empty($car)){?><li><?php echo udata('car',$car);?></li><?php }?>
        <?php if (!empty($nation)){?><li><?php echo udata('nation',$nation);?></li><?php }?>
        <?php $marrytime_str=udata('marrytime',$marrytime);if (!empty($marrytime) && $marrytime_str!='不限'){?><li>期望<?php echo $marrytime_str;?>结婚</li><?php }?>
        <li class="more" id="mydatamore">查看更多</li>
    </ul>
</div>
<?php
if($ifcontact){?>
	<div class="uline"></div>
	<div class="ubox ucontact">
		<h3 id="mycontact" class="zeaicolor">联系方式</h3>
		<ul id="mycontactmore">
			<?php if (ifmob($mob) && $mob_ifshow){?><li><i class="ico mob">&#xe627;</i><h5><?php echo substr($mob,0,3).'*****'.substr($mob,-3,3);?><br>点击查看</h5></li><?php }?>
			<?php if (!empty($weixin)){?><li><i class="ico weixin">&#xe607;</i><h5><?php echo substr($weixin,0,1).'****'.substr($weixin,-2,2);?><br>点击查看</h5></li><?php }?>
			<?php if (!empty($qq)){?><li><i class="ico qq">&#xe623;</i><h5><?php echo substr($qq,0,1).'****'.substr($qq,-2,2);?><br>点击查看</h5></li><?php }?>
			<?php if (!empty($weixin_pic)){?><li><i class="ico weixin_pic">&#xe62e;</i><h5>微信二维码<br>点击查看</h5></li><?php }?>
		</ul>
	</div>
	<?php if ( ifint($cook_uid)){?>
    <div id="contact_daylooknumHelp" class="helpDiv">
        <ul><?php
        foreach ($urole as $uv) {
            $grade = $uv->g;
            $title = $uv->t;
            $num   = $contact_daylooknum->$grade;
            $num_str = ($num>0)?' 每天能看<font class="Cf00">'.$num.'</font>人':' 无权查看';
            $ifmy = ($cook_grade==$grade)?'　　<font class="Cf00">（我）</font>':'';
            $outZ .= '<li>'.uicon($cook_sex.$grade).' '.$title.' <i class="ico">&#xe62d;</i>'.$num_str.$ifmy.'</li>';
        }echo $outZ;?>
        </ul>
        <a class="btn size3 VIP W100_" href="my_vip.php?jumpurl=<?php echo $jumpurl;?>"><i class="ico">&#xe6ab;</i> 开通VIP，畅通无极限</a>
    </div>
    <div id="contact_lovebHelp" class="helpDiv">
        <ul><?php
        foreach ($urole as $uv) {
            $grade = $uv->g;
            $title = $uv->t;
            $num   = $contact_loveb->$grade;
            $num_str = ($num>0)?' <font class="Cf00">'.$num.'</font> '.$_ZEAI['loveB'].'/人':' 免费查看';
            if($cook_grade==$grade){
                $ifmy = '　<font class="Cf00">（我）</font>';
                $myclkB=$num;
            }else{
                $ifmy = '';
            }
            $outE .= '<li>'.uicon($cook_sex.$grade).' '.$title.' <i class="ico">&#xe62d;</i>'.$num_str.$ifmy.'</li>';
        }echo $outE;
        //单次$myclkB解锁
        ?>
        </ul>
        <a class="btn size3 zeaibg W50_" onClick="clickloveb('contact',<?php echo $uid;?>)"><i class="ico">&#xe633;</i> 立即查看</a>
        <a class="btn size3 VIP W50_" href="my_vip.php?jumpurl=<?php echo $jumpurl;?>"><i class="ico">&#xe6ab;</i> 开通VIP</a>
    </div>
    <?php }
}?>
<?php if($Ukind==2 || $switch['Smode'][$Smode_g] == 2){?>
<div class="uline"></div>
<div class="ucontact ubox" onclick="hnFn();">
	<h3 class="zeaicolor">联系方式</h3><div class="contacthnC"><a href="javascript:;" class="zeaiboder zeaicolor"><i class="ico">&#xe613;</i> 点击联系专属红娘为您牵线</a></div>
</div>
<?php }//联系方法结束?>


<?php
//择偶要求
if(!empty($mate_li_out)){?>
<div class="uline"></div>
<div class="ubox umate">
	<h3 class="zeaicolor">择偶要求</h3>
	<ul><?php echo $mate_li_out;?></ul>
</div>
<?php }
//自我介绍
if (str_len($aboutus)>1){ ?>
<div class="uline"></div>
<div class="ubox uaboutus" id="btn_aboutus"><h3 class="zeaicolor">自我介绍</h3><div class="aboutusC"><?php echo $aboutus; ?></div></div>
<?php }?>
<div class="uline"></div>
<div class="uip ubox" <?php if ($cook_grade <=1){?> onclick="zeai.openurl('my_vip.php?jumpurl=<?php echo $jumpurl;?>');"<?php }?>>
    <h3 class="zeaicolor">最近登录</h3><div>
    <?php if ($cook_grade > 1 && ifint($cook_uid)){?>
    最近登录时间：<?php echo $endtime;?>
    <?php }else{ ?>
    最近登录时间：VIP用户可见 <i class="ico">&#xe62d;</i> <span class="zeaicolor" onclick="zeai.openurl('my_vip.php?jumpurl=<?php echo $jumpurl;?>');">点击开通VIP</span>
    <?php }?>  
    </div>
</div>
<?php
//立即开通VIP
if(ifint($cook_uid)){
	$uroleVIP = json_decode($_ZEAI['urole'],true);
	rsort($uroleVIP);$maxkey=max($uroleVIP);$maxg= $maxkey['g'];	
}
if($cook_grade<$maxg && $Ukind!=2 || !ifint($cook_uid)){// && $chcis_if?>
<div class="uline"></div>
<div class="ubox" id="btn_btmvip">
	<div class="vipbox">
		<span class="vipico"><?php echo $photo_m_str;?></span>
		<span class="viptitle">自由沟通-飞速脱单</span>
		<span class="vipc">相亲成功率提升300%</span>
		<span class="vipbtn" onClick="zeai.openurl('my_vip.php?jumpurl=<?php echo $jumpurl;?>')">开通VIP</span>
	</div>
</div>
<div class="uline"></div>
<?php }?> 
<br><br><br><br><br><br><br> 
<!--3按钮-->
<div class="btmbox">
    <?php if($ifchat || in_array('contact_hh',$navarr)  ){?><a id="hh"><i class="ico">&#xe629;</i></a><?php }?>
    <?php if ($ifhi){// && $chcis_if?><a id="hi"><i class="ico">&#xe8ca;</i></a><?php }?>
    <?php if($ifhn){?><a id="hn" onclick="<?php echo ($_ZEAI['homekefuewm']==1)?'hnFn2()':'hnFn()';?>"><i class="ico">&#xe613;</i></a><?php }?>
</div>
<?php if ($_ZEAI['homekefuewm']==1){?>
    <div class="lx_kefu" id="homekefuewm">
        <?php if (!empty($kf_wxpic) ){?><img src="<?php echo UP.$kf_wxpic;?>"><font>长按二维码加客服微信</font><br /><br /><?php }?>
        <?php if (!empty($kf_tel)){?>
            <i class="ico zeaicolor">&#xe68b;</i> <a href="tel:<?php echo $kf_tel;?>" class="zeaicolor"><?php echo $kf_tel;?> (点击拔打)</a>
        <?php }else{?>
            <?php if (!empty($kf_mob)){?><i class="ico zeaicolor">&#xe627;</i> <a href="tel:<?php echo $kf_mob;?>" class="zeaicolor"><?php echo $kf_mob;?> (点击拔打)</a><?php }?>
        <?php }?>
    </div>
	<?php
}
//互换开始
if($ifcontact_hh){
	if(ifint($cook_uid)){
		$cook_hh_num_ed = $db->COUNT(__TBL_HH__," senduid=".$cook_uid);
		$cook_hh_num_ed = ($cook_hh_num_ed>0)?'　<a href="my_huhuan.php">'.$cook_hh_num_ed.' 次互换记录</a>':'';
	}?>
	<div id="hhbox">
		<?php if($ifchat){?><a id="chat"><i class="ico">&#xe676;</i><span>在线聊天</span></a><?php }?>
		<a id="hh_wx"><i class="ico">&#xe607;</i><span>互换微信</span></a>
		<a id="hh_mob"><i class="ico">&#xe627;</i><span>互换手机</span></a>
	</div>
	<form id="hh_wx_form" class="hhbox_form">
		<div><i class="ico wxi">&#xe607;</i><input class="input" name="content" id="content" placeholder="请输入本人微信号" maxlength="20" value="<?php echo $cook_weixin;?>"></div>
		<em>对方同意后，将会把对方的微信号发送给您<br>您本人的微信号必须真实有效，否则将纳入失信人员名单并进行<font class="Cf00">封号处理</font></em>
		<input type="hidden" name="uid" value="<?php echo $uid;?>">
		<input type="hidden" name="submitok" value="ajax_hh_update">
		<input type="hidden" name="kind" value="weixin">
		<div class="sy">当前剩余<b><?php echo $cook_hh_num ;?></b>次<?php echo $cook_hh_num_ed;?></div>
		<button type="button" class="btn size3 zeaibg yuan" onClick="hhsend('hh_wx_form')">确认发送</button>
	</form>
	<form id="hh_mob_form" class="hhbox_form">
		<div><i class="ico mobi">&#xe627;</i><input class="input" name="content" id="content" placeholder="请输入本人手机号码" maxlength="11" value="<?php echo $cook_mob;?>"></div>
		<em>对方同意后，将会把对方的手机号码发送给您<br>您本人的手机号码必须真实有效，否则将纳入失信人员名单并进行<font class="Cf00">封号处理</font></em>
		<input type="hidden" name="uid" value="<?php echo $uid;?>">
		<input type="hidden" name="submitok" value="ajax_hh_update">
		<input type="hidden" name="kind" value="mob">
		<div class="sy">当前剩余<b><?php echo $cook_hh_num ;?></b>次<?php echo $cook_hh_num_ed;?></div>
		<button type="button" class="btn size3 zeaibg yuan" onClick="hhsend('hh_mob_form')">确认发送</button>
	</form>
	<script>
	hh.onclick=function(){zeai.mask({son:hhbox});}
	hh_wx.onclick=hh_wxFn;
	hh_mob.onclick=hh_mobFn;
	<?php if($ifchat)echo 'chat.onclick=chatFn;';?>
	</script>
	<?php
	//互换结束
}else{if($ifchat){echo '<script>hh.onclick=chatFn;</script>';}}?>
<!---->
<div id='tips0_100_0' class='tips0_100_0 alpha0_100_0'></div>
<div id="box_gift" class="box_gift">
    <em><img><h3></h3><h6></h6></em>
    <a href="javascript:;">看看其他礼物</a>
    <a href="javascript:;">确认赠送</a>
</div>
<?php if(@in_array('xqcard',$navarr) && $xqk_ifshow==1){?><a id="tgxqk" href="tg_my_ucard.php?submitok=tg_my_ucard_list&uid=<?php echo $uid;?>"><i class="ico">&#xe6b6;</i><span>相亲卡</span></a><?php }?>
<?php
//hibox
if ($ifhiher && in_array('hi',$navarr) && $Ukind!=2 && $_SMS['hi_kind']==2 && $cook_uid!=$uid){
	$hi_textlist=explode('<br>',$_SMS['hi_textlist']);
	$hi_textlist=shuffle_arr($hi_textlist);?>
<div id="hi_handbox">
	<a onClick="hi_refreshbtn(<?php echo $uid;?>);" class="zeaicolor B">换一组<i class="ico">&#xe67d;</i></a>
	<ul id="hi_list">
		<?php 
		if (count($hi_textlist) >= 1 && is_array($hi_textlist)){
			$h=0;
			foreach ($hi_textlist as $V) {
				if($h==4)continue;
				$V=trimhtml(dataIO($V,'out'));
				echo '<li><i class="ico zeaicolor">&#xe8ca;</i>'.$V.'</li>';
				$h++;
			}
		}
        ?>
    </ul>
    <button type="button" class="btn size4 zeaibg yuan" onClick="hi_btnFn(<?php echo $uid;?>);">开始发送 <i class="ico">&#xe6bd;</i></button>
</div>
<script>var ulli=zeai.tag(hi_list,'li');zeai.listEach(ulli,function(obj){obj.onclick=function(){resetclass(ulli);obj.class('ed');}});</script>
<?php }?>
<?php 
//红娘牵线
if(ifint($admid))$_ZEAI['homekefuewm']=0;
if($ifhn && $_ZEAI['homekefuewm']!=1){
	$rowhn = $db->ROW(__TBL_CRM_HN__,"id,truename,ewm,path_s","flag=1 AND ewm<>'' AND ifwebshow=1 AND id=".intval($cook_admid)." ORDER BY rand() LIMIT 1",'name');
	if (!$rowhn){
		$rowhn = $db->ROW(__TBL_CRM_HN__,"id,truename,ewm,path_s","flag=1 AND ewm<>'' AND ifwebshow=1 AND id=".$admid." ORDER BY rand() LIMIT 1",'name');
		if (!$rowhn)$rowhn = $db->ROW(__TBL_CRM_HN__,"id,truename,ewm,path_s","flag=1 AND ewm<>'' AND ifwebshow=1 ORDER BY rand() LIMIT 1",'name');
	}
	if ($rowhn){
		$hn_id       = $rowhn['id'];
		$hn_truename = dataIO($rowhn['truename'],'out');
		$hn_ewm      = $rowhn['ewm'];
		$path_s      = $rowhn['path_s'];
		$path_s_url  = (!empty($path_s))?UP.$path_s:RES.'m/img/hnico.jpg';
		$hn_ewm_url  = UP.$hn_ewm;
	}else{
		$hn_id = 0;
		$path_s_url = RES.'photo_m.png';
		$hn_ewm_url = UP.dataIO($_ZEAI['kf_wxpic'],'out');
	}
	if (!empty($cook_photo_s) && $cook_photo_f == 1){
		$cook_photo_m_url = UP.smb($cook_photo_s,'m');
	}else{
		$cook_photo_m_url = RES.'photo_m'.$cook_sex.'.png';
	}
	if($cook_qxnum_ed_herme>0){
		$qxbtn_str='<i class="ico">&#xe61b;</i> 牵线中';
		$qxbtn_cls='HUANG';
	}else{
		$qxbtn_str='委托【'.$hn_truename.'】牵线';
		$qxbtn_cls='zeaibg';
	}
	?>
    <script>var winh=<?php echo (is_weixin())?30.5:37.5;?>,qx_1price_C='<?php if($cook_qxnum==0 && $qx_1price>0)echo dataIO( $_VIP['qx_1price_C'],'out');?>';</script>
	<div id="hnbox">
		<dl><dt>
            <div class="senduid"><img src="<?php echo $cook_photo_m_url;?>" /><font class="zeaicolor">我<?php if (ifint($cook_uid)){?><span>ID：<?php echo $cook_uid;?></span><?php }?></font></div>
            <div class="admid"><em class="hnpic"><img src="<?php echo $path_s_url;?>" /><b>红娘</b></em><font class="zeaicolor"><?php echo $hn_truename;?></font></div>
            <div class="uid"><img src="<?php echo $photo_m_url;?>" /><font class="zeaicolor"><?php echo $nickname;?><span>ID：<?php echo $uid;?></span></font></div>           
			</dt><dd><img src="<?php echo $hn_ewm_url; ?>"><h6 class="C999">长按二维码加红娘微信</h6><a href="<?php echo a('{"kind":"my_hongniang"}');?>?t=qx&jumpurl=<?php echo $jumpurl;?>">我的牵线记录<?php if($cook_qxnum_ed>0)echo '('.$cook_qxnum_ed.')';?></a></dd>
		</dl>
		<button type="button" class="btn size4 yuan <?php echo $qxbtn_cls;?> " id="qx_btnFn" <?php if ($cook_qxnum_ed_herme == 0){?>onClick="qx_btnFn(<?php echo $uid;?>,<?php echo $hn_id;?>,'<?php echo $hn_truename;?>');"<?php }?>><?php echo $qxbtn_str;?></button>
	</div>
    <?php 
    	if($cook_qxnum==0 && $qx_1price>0){
		$jump_url = mHref('u',$uid);
		$money = $qx_1price;
		$kind  = 23;
		echo '<input type="hidden" id="money" value="'.$money.'">';
		echo '<input type="hidden" id="qx_admid" value="'.$hn_id.'">';
		echo '<input type="hidden" id="qx_uid" value="'.$uid.'">';?>
		<!--<a id="nextbtn">确认支付</a>-->
		<?php require_once 'my_pay.php';
	}
}?>

<script>
gz.onclick=gzFn;
Ublack.onclick=UblackFn;rtbox.children[2].onclick=inBlackFn;
<?php 
if (!empty($photo_s) && $photo_f == 1){?>
	var photo_b = '<?php echo $photo_b_url;?>';
	photo_m.onclick=photo_mFn;<?php
}
if ($photo_total > 0 && $ifblur==0){?>
	PlistFn(<?php echo $pic_list;?>);<?php
}
if (!empty($RZ) && @in_array('identity',$rz_dataARR) && $Ukind!=2){echo 'ucert.onclick=ucertFn;';}
if(@in_array('gift',$navarr)&&$Ukind!=2 && $cook_uid!=$uid){echo'setgift(gift,box_gift);';}
echo 'mydata.onclick=mydataFn;mydatamore.onclick=mydataFn;';
//查看联系方式
if ($ifcontact){echo 'mycontact.onclick=mycontactFn;mycontactmore.onclick=mycontactFn;';}
//打招呼
if ($ifhi){
	$hi_textlist=explode('<br>',$_SMS['hi_textlist']);
	$hi_textlist_num=count($hi_textlist);
	if($_SMS['hi_kind']==2){
		if($hi_textlist_num>1){
			echo 'hi.onclick=hiFn_hand;';
		}else{
			echo 'hi.onclick=function(){hiFn_send("'.trimhtml(dataIO($_SMS['hi_textlist'],'out')).'")}';
		}
	}else{
		echo 'hi.onclick=hiFn;';
	}
}
//if($ifhn){echo ($_ZEAI['homekefuewm']==1)?'hn.onclick=hnFn2()':'hn.onclick=hnFn()';}
?>
</script>
<?php
//蹦
$bounce=json_decode($_ZEAI['bounce'],true);
if($bounce['flag']['vipdatarz'] == 1 && ifint($cook_uid) && $cook_grade<=1 && !empty($bounce['vip_picurl']) && $Ukind!=2  ){
	$bouncev = '';
	$bounceTip = 'cook_my_bounce'.YmdHis(ADDTIME,'d');
	if($cook_grade<=1){ /*&& $_COOKIE[$bounceTip.'my_vip'] != 'my_vip'*/
		$bouncev=mHref('vip');$url=mHref('vip');$pageid='my_vip';$picurl=UP.$bounce['vip_picurl'];
	}
	if(!empty($bouncev)){
		//$bounceTip = $bounceTip.$bouncev;
		//if($_COOKIE[$bounceTip] != $bouncev){
		//	setcookie($bounceTip,$bouncev,null,"/",$_ZEAI['CookDomain']);
			?>
			<script>var u_divclose;setTimeout(function(){u_divclose=ZeaiM.div_pic({fobj:o('u'),obj:u_bounce_box,w:32,h:36});},1000);</script>
			<div id="u_bounce_box" class="bounce_box bounce"><img style="width:100%;display:block" src="<?php echo $picurl;?>" onClick="u_divclose.click();zeai.openurl('<?php echo $url;?>');"></div>
			<?php
		//}
	}
}
function get_udata_text($uid) {
	require_once ZEAI.'cache/config_wxgzh.php';
	global $db,$_ZEAI;
	$C = '';
	$fields = ",mate_age1,mate_age2,mate_heigh1,mate_heigh2,mate_weigh1,mate_weigh2,mate_pay,mate_edu,mate_love,mate_car,mate_house,mate_areaid,mate_areatitle,mate_job,mate_child,mate_marrytime,mate_companykind,mate_smoking,mate_drink,mate_areaid2,mate_areatitle2,mate_other";
	$row = $db->ROW(__TBL_USER__,"nickname,sex,birthday,areatitle,area2title,love,child,heigh,weigh,edu,pay,house,car,blood,pay,blood,job,marrytime,companykind,smoking,drink,marrytime,aboutus".$fields,"id=".$uid,"name");
	if ($row){
		$sex        = $row['sex'];
		$birthday   = $row['birthday'];
		$nickname   = trimhtml(dataIO($row['nickname'],'out'));
		$areatitle  = dataIO($row['areatitle'],'out');
		$heigh      = $row['heigh'];
		$weigh      = $row['weigh'];
		$love       = $row['love'];
		$child      = $row['child'];
		$edu        = $row['edu'];
		$pay        = $row['pay'];
		$job        = $row['job'];
		$house      = $row['house'];
		$car        = $row['car'];
		$blood      = $row['blood'];
		$aboutus    = trimhtml(dataIO($row['aboutus'],'out'));
		$mate       = mate_echo($row,'text');
		//
		$marrytime    = $row['marrytime'];
		$companykind  = $row['companykind'];
		$area2title  = dataIO($row['area2title'],'out');
		$smoking  = $row['smoking'];
		$drink    = $row['drink'];
		$area_s_title = explode(' ',$areatitle);$area_s_title = $area_s_title[1];
		$area_s_title2 = explode(' ',$area2title);$area_s_title2 = $area_s_title2[1].$area_s_title2[2];
		$sex_str2 = ($sex == 1)?'男':'女';
		$marrytime_str=udata('marrytime',$marrytime);
		$age_str  = (!empty($birthday) && $birthday!='0000-00-00')?'（'.getage($birthday).'岁）':'';
		$br = '\n';
		if(!empty($_GZH['wx_gzh_name'])){
			$C .= '#公众号：'.$_GZH['wx_gzh_name'].$br.$br;
		}
		$C .= 'ID：'.$uid.$br;
		$C .= '性别：'.$sex_str2.$br;
		if (!empty($nickname))$C .= '昵称：'.$nickname.$br;
		if (!empty($birthday) && $birthday!='0000-00-00')$C .= '生日：'.$birthday.$age_str.$br;
		if (!empty($areatitle))$C .= '工作地：'.$areatitle.$br;
		if (!empty($area2title))$C .= '户籍地：'.$area2title.$br;
		if (!empty($love)){
			 if (!empty($child))$child_str='（'.udata('child',$child).'）';
			$C .= '婚姻状况：'.udata('love',$love).$child_str.$br;
		}
		if (!empty($heigh))$C .= '身高：'.udata('heigh',$heigh).$br;
		if (!empty($weigh))$C .= '体重：'.udata('weigh',$weigh).$br;
		if (!empty($edu))$C .= '学历：'.udata('edu',$edu).$br;
		if (!empty($job))$C .= '职业：'.udata('job',$job).$br;
		if (!empty($companykind))$C .= '单位类型：'.udata('companykind',$companykind).$br;
		if (!empty($pay))$C .= '月收入：'.udata('pay',$pay).$br;
		if (!empty($house))$C .= '房子：'.udata('house',$house).$br;
		if (!empty($car))$C .= '车子：'.udata('car',$car).$br;
		//if (!empty($smoking))$C .= '抽烟：'.udata('smoking',$smoking).$br;
		//if (!empty($drink))$C .= '喝酒：'.udata('drink',$drink).$br;
		if (!empty($marrytime) && $marrytime_str!='不限'){
			$C .= '期望：'.$marrytime_str.'结婚'.$br;
		}
		if (!empty($aboutus))$C .= '自我介绍：'.$aboutus.$br;
		if (!empty($mate)){
			$sex_str = ($sex == 1)?'女，':'男，';
			$C .= $br.'💘择偶要求💘'.$br.$sex_str.$mate;
		}
		if(!empty($_ZEAI['kf_tel'])){
			$C .= $br.$br.'☎️红娘热线：'.$_ZEAI['kf_tel'];
		}
		$C .= $br.$br.'点击链接邂逅爱情：'.mHref('u',$uid);
	}
	return $C;
}
function mate_echo($row,$kind='') {
	global $_ZEAI;
	if(empty($_ZEAI['mate_diy']))return '';
	$mate_diy = explode(',',$_ZEAI['mate_diy']);
	$mate_age1      = intval($row['mate_age1']);
	$mate_age2      = intval($row['mate_age2']);
	$mate_heigh1    = intval($row['mate_heigh1']);
	$mate_heigh2    = intval($row['mate_heigh2']);
	$mate_pay       = $row['mate_pay'];
	$mate_edu       = $row['mate_edu'];
	$mate_areaid    = $row['mate_areaid'];
	$mate_areatitle = $row['mate_areatitle'];
	$mate_love      = $row['mate_love'];
	$mate_car       = $row['mate_car'];
	$mate_house     = $row['mate_house'];
	$mate_weigh1      = intval($row['mate_weigh1']);
	$mate_weigh2      = intval($row['mate_weigh2']);
	$mate_job         = $row['mate_job'];
	$mate_child       = $row['mate_child'];
	$mate_marrytime   = $row['mate_marrytime'];
	$mate_companykind = $row['mate_companykind'];
	$mate_smoking     = $row['mate_smoking'];
	$mate_drink       = $row['mate_drink'];
	$mate_areaid2     = $row['mate_areaid2'];
	$mate_areatitle2  = $row['mate_areatitle2'];
	$mate_other       = dataIO($row['mate_other'],'out');
	$ifmate = ( !empty($mate_age1) || !empty($mate_age2) || !empty($mate_heigh1) || !empty($mate_heigh2) || !empty($mate_pay) || !empty($mate_edu) || !empty($mate_areaid) || !empty($mate_areatitle) || !empty($mate_love) || !empty($mate_house) || !empty($mate_job) || !empty($mate_child) || !empty($mate_marrytime) || !empty($mate_companykind) || !empty($mate_smoking) || !empty($mate_drink) || !empty($mate_areaid2)  || !empty($mate_areatitle2) || !empty($mate_other)  )?true:false;
	if($ifmate){
		$mate_age       = $mate_age1.','.$mate_age2;
		$mate_age_str   = mateset_out($mate_age1,$mate_age2,'岁');
		$mate_age_str = str_replace("不限","",$mate_age_str);
		$mate_heigh     = $mate_heigh1.','.$mate_heigh2;
		$mate_heigh_str = mateset_out($mate_heigh1,$mate_heigh2,'cm');
		$mate_heigh_str = str_replace("不限","",$mate_heigh_str);
		$mate_weigh     = $mate_weigh1.','.$mate_weigh2;
		$mate_weigh_str = mateset_out($mate_weigh1,$mate_weigh2,'kg');
		$mate_weigh_str = str_replace("不限","",$mate_weigh_str);
		$mate_areaid_str  = (!empty($mate_areatitle))?$mate_areatitle:'';
		$mate_areaid2_str = (!empty($mate_areatitle2))?$mate_areatitle2:'';
		$mate_pay_str   = udata('pay',$mate_pay);
		$mate_edu_str   = udata('edu',$mate_edu);
		$mate_love_str  = udata('love',$mate_love);
		$mate_car_str   = udata('car',$mate_car);
		$mate_house_str = udata('house',$mate_house);
		$mate_job_str         = udata('job',$mate_job);
		$mate_child_str       = udata('child',$mate_child);
		$mate_marrytime_str   = udata('marrytime',$mate_marrytime);
		$mate_companykind_str = udata('companykind',$mate_companykind);
		$mate_smoking_str     = udata('smoking',$mate_smoking);
		$mate_drink_str       = udata('drink',$mate_drink);
		$mate_li_out='';
		if (count($mate_diy) >= 1 && is_array($mate_diy)){
			foreach ($mate_diy as $k=>$V) {
				$ext = mate_diy_par($V,'ext');
				$tmpD = 'mate_'.$V;
				$tmpS = 'mate_'.$V.'_str';
				$mate_data = $$tmpD;
				$mate_str  = $$tmpS;
				if(!empty($mate_data) && $mate_data!='0,0'){
					switch ($ext) {
						case 'checkbox':
							$mate_str_=explode(',',$mate_str);
							$mate_strN=count($mate_str_);
							if($mate_strN>1){
								$matesonli='';
								foreach ($mate_str_ as $ks=>$Vs) {$matesonli.='【'.$Vs.'】';}
								$mate_str = $matesonli;
							}
						break;
						default:break;
					}
					if($kind=='text'){
						$mate_li_out.=$mate_str.'，';
					}elseif($kind=='li'){
						$mate_li_out.='<li>'.$mate_str.'</li>';
					}else{
						$mate_li_out.='<li><font>'.mate_diy_par($V).'：</font>'.$mate_str.'</li>';
					}
				}
			}
			if($kind=='text'){
				$mate_li_out = rtrim($mate_li_out,'，');
				$mate_li_out .= (!empty($mate_other))?'，其他要求：'.$mate_other:'';
			}elseif($kind=='li'){
				$mate_li_out .= (!empty($mate_other))?'<li>'.$mate_other.'</li>':'';
			}else{
				$mate_li_out .= (!empty($mate_other))?'<li><font>其他要求：</font>'.$mate_other.'</li>':'';
			}
		}
	}
	return $mate_li_out;
}
?></body></html><?php ob_end_flush();?>